package c.h.b.a.b;

import android.content.Context;
import android.graphics.Point;
import android.util.Log;
import android.view.View;
import c.h.b.a.a.d;
import com.bytedance.sdk.openadsdk.AdSlot;
import com.bytedance.sdk.openadsdk.AdSlot.Builder;
import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTAdNative.RewardVideoAdListener;
import com.bytedance.sdk.openadsdk.TTAdNative.SplashAdListener;
import com.bytedance.sdk.openadsdk.TTAdSdk;
import com.bytedance.sdk.openadsdk.TTRewardVideoAd;
import com.bytedance.sdk.openadsdk.TTSplashAd;
import com.bytedance.sdk.openadsdk.TTSplashAd.AdInteractionListener;

/* compiled from: TTAdLoader */
public class g implements d {

    /* compiled from: TTAdLoader */
    public class a implements RewardVideoAdListener {
        public final /* synthetic */ c.h.b.a.a.b a;

        public a(g gVar, c.h.b.a.a.b bVar) {
            this.a = bVar;
        }

        public void onError(int i, String str) {
            c.h.b.a.a.b bVar = this.a;
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("tt-reward:code=");
            stringBuilder.append(i);
            stringBuilder.append(",msg=");
            stringBuilder.append(str);
            bVar.d(stringBuilder.toString());
        }

        public void onRewardVideoAdLoad(TTRewardVideoAd tTRewardVideoAd) {
            c.h.b.a.a.b bVar = this.a;
            bVar.f(new b(this, tTRewardVideoAd, bVar));
        }

        public void onRewardVideoCached() {
        }
    }

    /* compiled from: TTAdLoader */
    public class b implements SplashAdListener {
        public final /* synthetic */ c.h.b.a.a.b a;

        /* compiled from: TTAdLoader */
        public class a implements AdInteractionListener {
            public void onAdClicked(View view, int i) {
                b.this.a.a();
            }

            public void onAdShow(View view, int i) {
                b.this.a.b();
            }

            public void onAdSkip() {
                b.this.a.g();
            }

            public void onAdTimeOver() {
                b.this.a.h();
            }
        }

        public b(g gVar, c.h.b.a.a.b bVar) {
            this.a = bVar;
        }

        public void onError(int i, String str) {
            c.h.b.a.a.b bVar = this.a;
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("tt-splash:code=");
            stringBuilder.append(i);
            stringBuilder.append(",msg=");
            stringBuilder.append(str);
            bVar.d(stringBuilder.toString());
        }

        public void onSplashAdLoad(TTSplashAd tTSplashAd) {
            if (tTSplashAd == null) {
                this.a.d("tt-splash:ad null");
                return;
            }
            tTSplashAd.setSplashInteractionListener(new a());
            this.a.e(tTSplashAd.getSplashView());
        }

        public void onTimeout() {
            this.a.d("tt-splash:timeout");
        }
    }

    public void a(Context context, c.h.b.a.a.a aVar, c.h.b.a.a.b bVar) {
        Builder adCount = new Builder().setCodeId(aVar.a).setSupportDeepLink(true).setAdCount(1);
        Point point = aVar.e;
        TTAdSdk.getAdManager().createAdNative(context).loadNativeExpressAd(adCount.setExpressViewAcceptedSize((float) point.x, (float) point.y).setImageAcceptedSize(1080, 720).build(), new h(this, aVar, bVar, "native", context));
        if (c.a) {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("loadNativeAd: ");
            stringBuilder.append(aVar);
            Log.d("AlphaAdLoader", stringBuilder.toString());
        }
    }

    public void b(Context context, c.h.b.a.a.a aVar, c.h.b.a.a.b bVar) {
        Builder adCount = new Builder().setCodeId(aVar.a).setSupportDeepLink(true).setAdCount(1);
        Point point = aVar.e;
        AdSlot build = adCount.setExpressViewAcceptedSize((float) point.x, (float) point.y).build();
        TTAdNative createAdNative = TTAdSdk.getAdManager().createAdNative(context);
        if (c.a) {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("loadBannerAd: ");
            stringBuilder.append(aVar);
            Log.d("AlphaAdLoader", stringBuilder.toString());
        }
        createAdNative.loadBannerExpressAd(build, new h(this, aVar, bVar, "banner", context));
    }

    public void c(Context context, c.h.b.a.a.a aVar, c.h.b.a.a.b bVar) {
        String str = "";
        TTAdSdk.getAdManager().createAdNative(context).loadRewardVideoAd(new Builder().setCodeId(aVar.a).setSupportDeepLink(true).setAdCount(1).setImageAcceptedSize(1080, 1920).setRewardName("Donate").setRewardAmount(1).setUserID(str).setOrientation(1).setMediaExtra(str).build(), new a(this, bVar));
    }

    public void d(Context context, c.h.b.a.a.a aVar, c.h.b.a.a.b bVar) {
        TTAdSdk.getAdManager().createAdNative(context).loadSplashAd(new Builder().setCodeId(aVar.a).setSupportDeepLink(true).setImageAcceptedSize(1080, 1920).build(), new b(this, bVar));
    }
}
